<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2021-07-10陈亮晚间学习9:45-</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .box{
            width: 400px;
            height: 400px;
            border: 1px solid #ccc;
            margin: 20px;
        }
        .box .tab{
            display: flex;
        }
        .tab li{
            border: 1px solid #ccc;
            margin: 15px;
            padding: 5px 10px;
            cursor: pointer;
        }
        .tab li.active{
            background-color: orangered;
            color:white;
        }
        .list{
            margin: 0 5px;

        }
        .list li{
            display: none;
        }
        .list li.show{
            display: block;
        }
    </style>

</head>

<body>
    <div class="box">
        <ul class="tab">
            <li class="active">奔驰</li>
            <li>宝马</li>
            <li>奥迪</li>
        </ul>
        <ul class="list">
            <li class="show">奔驰内饰</li>
            <li>宝马运动</li>
            <li>奥迪大灯</li>
        </ul>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <script>
        $(`.tab li`).click(function(){
$(this).addClass(`active`).siblings(`.active`).removeClass(`active`)
$(`.list li`).eq($(this).index()).addClass(`show`).siblings(`.show`).removeClass(`show`)
        })
    </script>
</body>

</html>